#ifndef _GRTSP_
#define _GRTSP_
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "stdbool.h"

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <sys/time.h>

#define  G_LEN_32 (32)
#define  G_LEN_64 (64)
#define  G_LEN_128 (128)
#define  G_LEN_256 (256)
#define  G_LEN_512 (512)
#define  G_LEN_1024 (1024)

#define G_REQUSTE_TIMEOUT_S (5)

typedef  struct _rtspHeader{
    char Method[G_LEN_32];
    char ip[G_LEN_32];
    int  port;
    char path[G_LEN_256];
}g_rtspHeader;

typedef  struct _rtspAuthInfo{
    char user[G_LEN_64];
    char pwd[G_LEN_64];
    char realm[G_LEN_256];
    char nonce[G_LEN_256];
    char uri[G_LEN_256];
    char response[G_LEN_256];
    bool isSuc;
}g_rtspAuthInfo;

typedef  struct _rtsp{
    g_rtspHeader    header;
    g_rtspAuthInfo  authInfo;
    int             cseq;
    char            agent[G_LEN_256];
    char            accept[G_LEN_256];
    int             rtsp_sock;
    char            srv_supCmdList[G_LEN_512];
    int             rspCode;         
}g_rtspRequest;

#define LOG(fmt, args...) printf("%s-%s()-%d: "fmt"\n", __FILE__, __FUNCTION__,__LINE__, ##args); 


int  grtsp_paraseUrl(g_rtspHeader* header,g_rtspAuthInfo *authinfo,char* url);
int  grtsp_createTcpSocket(g_rtspRequest request);
int  grtsp_sendOptions(g_rtspRequest * request);
int  grtsp_sendDescribe(g_rtspRequest * request);
#endif